<template>
  <div class="emit">
    <h3>当前数值为：{{ count }}</h3>
    <c1 @go-add="add" />
    <c2 @do-set="setCount" />
    <c3 @reset="resetCount" />
  </div>
</template>

<script>
import c1 from './c1.vue'
import c2 from './c2.vue'
import c3 from './c3.vue'

export default {
  name: 'TestEmit',
  components: { c1, c2, c3 },
  data() {
    return {
      count: 0,
    }
  },
  methods: {
    add() {
      this.count++
    },
    setCount(num) {
      this.count = num
    },
    resetCount() {
      this.count = 0
    }
  }
}
</script>